<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>选择器</title>
    <script type="text/javascript" src="../js/jquery-3.4.1.min.js"></script>
    <script>
        $(function () {
            console.log($("#p1"))
            console.log($(".c1"))
            console.log($("p"))
            console.log($("*"))
            console.log($("#p1,.c1"));
            console.log($(".c2 span")); // 后代
            console.log($(".c2>span")); // 子元素
            console.log($(".c3+span")); // 紧跟着
            console.log($(".c3~span")); // 后面的
            console.log($("span[name='test']"))
            console.log($("li:first"))
            console.log($("li:last"))
            console.log($("li:even"))
            console.log($("li:odd"))
        })
    </script>
</head>
<body>
<p id="p1">这是id为p1的段落</p>
<p class="c1">这是c1的段落</p>
<p class="c1">这是c1的段落</p>
<div class="c1">这是c1的div</div>
<div>这是普通div</div>
<hr>
<div class="c2">
    <span name="test">这是c2中的span</span>
    <div>这是c2中的div</div>
    <div>
        <span>这是c2中的div中的span</span>
    </div>
</div>
<div class="c3">这是c3</div>
<span name="test">这是c3后面的span</span>
<span>这是c3后面的span</span>
<span>这是c3后面的span</span>
<ul>
    <li>item0</li>
    <li>item1</li>
    <li>item2</li>
    <li>item3</li>
    <li>item4</li>
    <li>item5</li>
</ul>
</body>
</html>